package com.idealighter.game.roomcard.common;

import com.idealighter.game.games.common.AbstractSeat;
import com.idealighter.game.games.common.SeatState;
import com.idealighter.game.roomcard.struct.RoomCardRoomCfg;
import com.idealighter.game.roomcard.struct.RoomCardRoomCfgValue;

/**
 * 座位.
 *
 */
public abstract class AbstractRoomCardSeat<//
    RCFGT extends RoomCardRoomCfg<RCFGVT>, //
    RCFGVT extends RoomCardRoomCfgValue> extends AbstractSeat {
  // 是否为旁观者
  private boolean byStander = true;
  // 是否托管
  private boolean sysHost = false;
  // 所属的桌子
  private final AbstractRoomCardTable<? extends AbstractRoomCardSeat<RCFGT, RCFGVT>, //
      RCFGT, RCFGVT> table;

  public <T extends AbstractRoomCardTable<? extends AbstractRoomCardSeat<RCFGT, RCFGVT>, //
      RCFGT, RCFGVT>> AbstractRoomCardSeat(int order, T table) {
    super(order);
    this.table = table;
  }

  public AbstractRoomCardTable<? extends AbstractRoomCardSeat<RCFGT, RCFGVT>, //
      RCFGT, RCFGVT> getTable() {
    return table;
  }

  public boolean isByStander() {
    return byStander;
  }

  protected void setByStander(boolean byStander) {
    this.byStander = byStander;
  }

  public boolean isSysHost() {
    return sysHost;
  }

  public void setSysHost(boolean sysHost) {
    this.sysHost = sysHost;
  }

  /**
   * @Title clear.
   * @Description 清空
   * @date 2018年6月13日 上午11:09:11
   */
  public void clear() {
    this.playerId = 0;
    this.playerName = null;
    this.sex = -1;
    this.totalChips = 0L;
    this.state = SeatState.SEATED;
  }
}
